package com.copote.vmp.basedata;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@Slf4j
@SpringBootApplication(scanBasePackages = {"com.copote"})
public class VmpModuleBasedataApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(VmpModuleBasedataApplication.class, args);
        Environment env = context.getEnvironment();
        String name = env.getProperty("spring.application.name");
        String active = env.getProperty("spring.profiles.active");
        String ip = cn.hutool.core.net.NetUtil.getLocalhostStr();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n" +
                "Application " + name + "-" + active + " is running! Access URLs:\n" +
                "Local:    http://127.0.0.1:" + port + path + "/doc.html\n" +
                "External: http://" + ip + ":" + port + path + "/doc.html\n" +
                "----------------------------------------------------------");
        log.info("工程 {} 启动成功：{}", name, new cn.hutool.core.date.DateTime());
    }
}
